package 笔试.京东;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Scanner;

/**
 * @author: 谢君臣
 * @Date: 2021/10/9-18:17
 * @version: 1.0
 * @function:
 */
public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        HashMap<Integer,Integer> hash = new HashMap<>();
        HashMap<Integer,int[]> index = new HashMap<>();
        for (int i = 0; i < n; i++) {
            int k = scanner.nextInt();
            hash.put(k,hash.getOrDefault(k,0)+1);
            if (index.containsKey(k)){
                int[] temp = index.get(k);
                temp[1] = i+1;
            //   index.put(k,new int[]{index.get(k)[0],i+1});  // 开始位置不变
            }else {
                index.put(k,new int[]{i+1,i+1}); // 开始和结束位置相同
            }
        }
        int max =0,start=0,end=0;
        Iterator<Integer> iterator = hash.keySet().iterator();
        while (iterator.hasNext()) {
            Integer key = iterator.next();
            if (hash.get(key)>max){
                int[] ints = index.get(key);
                max = hash.get(key);
                start = ints[0];
                end = ints[1];
            }else if (hash.get(key)==max){
                int[] ints = index.get(key);
                max = hash.get(key);
                if (ints[1]-ints[0]<end-start)
                {
                    start = ints[0];
                    end = ints[1];
                }
            }
        }
        System.out.println(start+" "+end);
    }
}
